package com.fit.pianosheetshop.pages;

import org.apache.tapestry5.annotations.Property;
import org.apache.tapestry5.annotations.SessionState;

import org.apache.tapestry5.ioc.annotations.Inject;

import com.fit.pianosheetshop.interfaces.Borrow;
import com.fit.pianosheetshop.interfaces.Sheet;
import com.fit.pianosheetshop.interfaces.User;
import com.fit.pianosheetshop.service.Borrows;



public class ViewBorrow {
	@Inject
	@Property
	private Borrows borrows;
	
	@Property
	private Borrow currentBorrow;
	
	public Sheet getFirstSheet() {
		return currentBorrow.getSheet().get(0);
	}
	
	@SessionState
	private User user;

	private boolean userExists;
	
	public User getUser() {
		return user;
	}
	
	Object onActivate() {
		if (!userExists) return Login.class;
		return null;
	}

}
